{extend name="public/base" /}



{block name="title"}<title>{if $data}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}



{block name="pjax_container"}

<section class="content-header">

    <h1>{$Think.lang.c_title}{$Think.lang.info}</h1>

</section>

<section class="content">

    <div class="row">

        <div class="col-md-12">

            <form class="form-horizontal" method="POST" action="" onsubmit="return false" >

                <div class="nav-tabs-custom">

                    <ul class="nav nav-tabs">

                        <li class="active"><a href="#tab1" data-toggle="tab">{$Think.lang.base_param}</a></li>

                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> {$Think.lang.back}</a></li>

                    </ul>

                    <div class="tab-content">

                        <div class="tab-pane active" id="tab1">

                            <input type="hidden" name="id" value="{$data.id}" />

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'nickName',

                                'title' => $Think.lang.nickName,

                                'placeholder' => $Think.lang.nickName,

                            ]])}
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'nickName',

                                'title' => $Think.lang.nickName,

                                'placeholder' => $Think.lang.nickName,

                            ]])}
                            <div class="form-group">
                              <label class="col-sm-2 control-label"><i></i>所在地址</label>
                                <div class="col-sm-7">
                                    <div class="col-sm-3">
                                      {php}
                                        if(isset($data['info']['province'])){
                                          echo "<select name='province' id='province' class='province form-control'><option value=".$data['info']['province'].">".$data['info']['province1']."</option></select>";
                                        }else{
                                          echo '<select name="province" id="province" class="province form-control" >
                                            <option value="">请选择省</option>
                                        </select>';
                                        }
                                      {/php}
                                        
                                    </div>
                                    <div class="col-sm-3">
                                      {php}
                                        if(isset($data['info']['city'])){
                                          echo "<select name='city' id='city' class='city form-control'><option value=".$data['info']['city'].">".$data['info']['city1']."</option></select>";
                                        }else{
                                          echo '<select name="city" id="city" class="city form-control">
                                            <option value="">请选择城市</option>
                                        </select>';
                                        }
                                      {/php}
                                    </div>
                                    <div class="col-sm-3">
                                      {php}
                                        if(isset($data['info']['district'])){
                                            echo "<select name='district' id='district' class='istrict form-control' ><option value=".$data['info']['district'].">".$data['info']['district1']."</option></select>";
                                          }else{
                                            echo '<select name="district" id="district" class="district form-control" >
                                              <option value="">请选择县区</option>
                                            </select>';
                                          }
                                      {/php}
                                    </div>
                                </div>
                            </div>
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'gender',

                                'title' => $Think.lang.gender,

                                'placeholder' => $Think.lang.gender,

                            ]])}
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'brithday',

                                'title' => $Think.lang.brithday,

                                'placeholder' => $Think.lang.brithday,

                            ]])}
                            
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'luck_point',

                                'title' => $Think.lang.luck_point,

                                'placeholder' => $Think.lang.luck_point,

                            ]])}
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'school_name',

                                'title' => $Think.lang.school_name,

                                'placeholder' => $Think.lang.school_name,

                            ]])}

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'depart',

                                'title' => $Think.lang.depart,

                                'placeholder' => $Think.lang.depart,

                            ]])}

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'major',

                                'title' => $Think.lang.major,

                                'placeholder' => $Think.lang.major,

                            ]])}

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'dorm',

                                'title' => $Think.lang.dorm,

                                'placeholder' => $Think.lang.dorm,

                            ]])}

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'senior_name',

                                'title' => $Think.lang.senior_name,

                                'placeholder' => $Think.lang.senior_name,

                            ]])}
                            
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'high_name',

                                'title' => $Think.lang.high_name,

                                'placeholder' => $Think.lang.high_name,

                            ]])}
                            
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'is_single',

                                'title' => $Think.lang.is_single,

                                'placeholder' => $Think.lang.is_single,

                            ]])}
                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'hobby',

                                'title' => $Think.lang.hobby,

                                'placeholder' => $Think.lang.hobby,

                            ]])}

                            {:widget('common/Input/index', [$data['info'], [

                                'name' => 'character',

                                'title' => $Think.lang.character,

                                'placeholder' => $Think.lang.character,

                            ]])}

                        </div>

                    </div>

                    <div class="box-footer">

                        <div class="col-sm-2"></div>

                        <div class="col-sm-7">

                            <!-- <div class="btn-group pull-right">

                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {$Think.lang.submit}">{$Think.lang.submit}</button>

                            </div> -->

                           <!--  <div class="btn-group pull-left">

                                <button type="reset" class="btn btn-warning">{$Think.lang.reset}</button>

                            </div> -->

                        </div>

                    </div>

                </div>

            </form>

        </div>

    </div>

</section>

<script type="text/javascript">

$(function(){

    /*ajax页面加载icheck，有该控件的页面才需要*/

    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({

        checkboxClass: 'icheckbox_minimal-blue',

        radioClass: 'iradio_minimal-blue'

    });

    

    /*ajax页面加载select2，有该控件的页面才需要*/

    $(".select2").select2({language:"zh-CN"});



    var pid = 0;

    $.ajax({

       url: "{:url('agent/getCity')}",

       type: 'POST',

       dataType: 'json',

       data: {'area_pid': pid},

       success:function(data){

        console.log(data);

        var str = '';

        for(var i=0;i<data.info.length;i++){

          str+='<option value='+data.info[i]['area_id']+'>'+data.info[i]['area_name']+'</option>';

        }

        $("#province").append(str);

       },

       error:function(e){},

    });

    $('#province').change(function(event) {

        /* Act on the event */

        var pid = $(this).val();

        $.ajax({

           url: "{:url('agent/getCity')}",

           type: 'POST',

           dataType: 'json',

           data: {'area_pid': pid},

           success:function(data){

            console.log(data);

            var str = '<option value="">请选择市</option>';

            for(var i=0;i<data.info.length;i++){

              str+='<option value='+data.info[i]['area_id']+'>'+data.info[i]['area_name']+'</option>';

            }

            $("#city").html(str);

           },

           error:function(e){},

        });

    });

    $('#city').change(function(event) {

        /* Act on the event */

        var pid = $(this).val();

        $.ajax({

           url: "{:url('agent/getCity')}",

           type: 'POST',

           dataType: 'json',

           data: {'area_pid': pid},

           success:function(data){

            console.log(data);

            var str = '<option value="">请选择地区</option>';

            for(var i=0;i<data.info.length;i++){

              str+='<option value='+data.info[i]['area_id']+'>'+data.info[i]['area_name']+'</option>';

            }

            $("#district").html(str);

           },

           error:function(e){},

        });

    });

})

</script>

{/block}